home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c1.zip / WRITE.C < prev   
Text File  |  1987-06-18  |  1KB  |  42 lines

  1.  
  2. /***********************************************************
  3.  *     IBM PC "C" Bulletin Board                           *
  4.  *     Tulsa, OK  918-664-8737                             *
  5.  *     SYSOP Lynn Long   300/1200 XMODEM                   *
  6.  ***********************************************************/
  7.  
  8.  
  9. #include "io.h"
  10. #include "errno.h"
  11.  
  12. int filewr(), badfd(), conwr();
  13.  
  14. static int (*wrt_tab[])() = {
  15.         badfd, filewr, conwr,
  16. };
  17.  
  18. write(fd, buff, len)
  19. char *buff;
  20. {
  21.         register struct channel *chp;
  22.  
  23.         if (fd < 0 || fd > MAXCHAN) {
  24.                 errno = EBADF;
  25.                 return -1;
  26.         }
  27.         chp = &chantab[fd];
  28.         return (*wrt_tab[chp->c_write])(chp->c_arg, buff, len);
  29. }
  30.  
  31. conwr(kind, buff, len)
  32. register char *buff;
  33. {
  34.         register int count;
  35.  
  36.         for (count = 0 ; count < len ; ++count)
  37.                 bdos(kind, *buff++);
  38.         return count;
  39. }
  40.  
  41.  
  42.